﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frame.Lib.Enums;
using Frame.Lib.Common;
using System.Web.UI.HtmlControls;
using System.Web.UI;

namespace Frame.Lib.Web
{
    public sealed class CssFileManager
    {
        public static void SetCssFile(HtmlLink lnk, CssFile fileName)
        {
            lnk.Href = GlobalVar.WebAppPath + Constants.CSS_FILE_PATH + "skin1/" + fileName + ".css";
        }


        public static void SetCssFile(HtmlGenericControl lnk, CssFile fileName)
        {
            lnk.Attributes["href"] = GlobalVar.WebAppPath + Constants.CSS_FILE_PATH + "skin1/" + fileName + ".css";
        }

        public static void AddCssFile(CssFile fileName)
        {
            //System.Web.HttpContext.Current.
            HtmlLink myHtmlLink = new HtmlLink();
            myHtmlLink.Href = "~/" + Constants.CSS_FILE_PATH + "skin1/" + fileName + ".css";
            myHtmlLink.Attributes.Add("rel", "stylesheet");
            myHtmlLink.Attributes.Add("type", "text/css");

            ((Page)System.Web.HttpContext.Current.CurrentHandler).Header.Controls.Add(myHtmlLink);

        }
    }
}
